<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a><cite>代付测试</cite></a>
    </span>
</div>
<style>
    xmp {
        white-space: pre-wrap;
        white-space: -moz-pre-wrap;
        white-space: -pre-wrap;
        white-space: -o-pre-wrap;
        word-wrap: break-word;
    }
</style>
<div style="display:none" id="formJump"></div>
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-tab layui-tab-brief">
      
       <form class="layui-form">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">模拟订单数据</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="layui-form-label">代付金额(元)(amount)</label>
                        <div class="layui-input-block">
                            <input type="text" id="amount" name="amount" lay-verify="number" autocomplete="off" placeholder="请输入amount,单位元" class="layui-input" value="500">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账户属性(accountAttr)</label>
                        <div class="layui-input-block">
                            <input type="radio" name="accountAttr" value="0" title="银行卡" lay-filter="accountTypeFilter" checked>
                            <input type="radio" name="accountAttr" value="0" title="支付宝" lay-filter="accountTypeFilter" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账户名称(accountName)</label>
                        <div class="layui-input-block">
                            <input type="text" id="accountName" name="accountName" placeholder="请输入账户名称" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号(accountNo)</label>
                        <div class="layui-input-block">
                            <input type="text" id="accountNo" name="accountNo" placeholder="请输入账号" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="pubAccount" style="display: block">
                        <label class="layui-form-label">银行名称(bankName)</label>
                        <div class="layui-input-block">
                            <select name="bankName" id="bankName" lay-filter="mySelect" placeholder="请选择银行">
                                <option value="alipay">支付宝</option>
                                <option value="中国工商银行">工商银行</option>
                                <option value="中国农业银行">农业银行</option>
                                <option value="中国银行">中国银行</option>
                                <option value="中国建设银行">中国建设银行</option>
                                <option value="交通银行">交通银行</option>
                                <option value="中信银行">中信银行</option>
                                <option value="中国光大银行">光大银行</option>
                                <option value="华夏银行">华夏银行</option>
                                <option value="中国民生银行">中国民生银行</option>
                                <option value="广发银行股份有限公司">广发银行</option>
                                <option value="浦发银行">浦发银行</option>
                                <option value="中国邮政储蓄银行">中国邮政储蓄银行</option>
                                <option value="平安银行（原深圳发展银行）">平安银行</option>
                                <option value="招商银行">招商银行</option>
                                <option value="兴业银行">兴业银行</option>
                                <option value="上海农商银行">上海农商银行</option>
                                <option value="徽商银行">徽商银行</option>
                                <option value="深圳前海微众银行">深圳前海微众银行</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">回调地址(notifyUrl)</label>
                        <div class="layui-input-block">
                            <input type="text" id="notifyUrl" name="notifyUrl" lay-verify="url" autocomplete="off" placeholder="请输入notifyUrl" class="layui-input" value="http://www.baidu.com">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注(remark)</label>
                        <div class="layui-input-block">
                            <textarea name="remark" id="remark" placeholder="请输入备注" class="layui-input"></textarea>
                        </div>
                    </div>
                <div class="layui-form-item ">
                    <div class="layui-input-block">
                        <button type="button" lay-submit lay-filter="btnJSJ" class="layui-btn">提交申请</button>
                    </div>
                </div>
            </div>
            </div>
        </form>
    </div>
  </div>
</div>

<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use(['element', 'form', 'admin', 'citypicker'], function(){
        var form = layui.form
        ,$ = layui.$
        ,element = layui.element
        ,layer = layui.layer
        , citypicker = layui.citypicker
        ,admin = layui.admin;
        var host = window.location.host;
        $("#notifyUrl").val("http://" + host + "/api/paydemo/notify.htm");
        $("#returnUrl").val("http://" + host + "/api/paydemo/return.htm");

        // var currentPicker = new citypicker("#cityPicker", {
        //     provincename: "provinceId",
        //     cityname: "cityId",
        //     districtname: "districtId",
        //     level: 'cityId',// 级别
        // });


        form.on('submit(btnJSJ)', function (data) {
            // 校验
            // var provinceCity = $("#cityPicker").val();
            // if (provinceCity && provinceCity != '') {
            //     var strings = provinceCity.split("/");
            //     data.field.province = strings[0];
            //     data.field.city = strings[1];
            // }

            var agentpayAmount = $("#amount").val();
            layer.confirm("代付金额:"+agentpayAmount+"元,确定提交么?", function(index){
                admin.req({
                    type: 'post',
                    url: layui.setter.baseUrl + '/paydemo/agentpay',
                    data: data.field,
                    success: function(res){
                        layer.close(index);
                        if(res.code == 0){
                            layer.alert("申请成功,最终代付结果查看代付列表!", function(index){
                                location.hash = '/agentpay/list';
                            })
                        }
                    }
                });
            });
            return false;//阻止跳转
        });
        form.render();
    });
</script>




